#include <stdio.h>
#include <stdlib.h>

#include "conf-yaml.h"
#include "conf-yaml-loader.h"


const char * yaml_path = "./test/tt.yaml" ;


int main(int argc, int argv) {

    ConfInit() ;
    ConfYamlLoadFile(yaml_path) ;

    ConfNode *yaml_root = ConfGetRootNode() ;

    printf("\n\n\n\n==============  result ===============\n\n") ;
    ConfDump() ;

    const char * vptr ;

    char * tnm = "score.0.name" ;
    ConfGet(tnm, &vptr) ;
    printf("\n\n---------%s: %s\n", tnm, vptr) ;

    tnm = "aa" ;
    ConfGet(tnm, &vptr) ;
    printf("---------%s: %s\n", tnm, vptr) ;

    tnm = "t-inc.cc" ;
    ConfGet(tnm, &vptr) ;
    printf("---------%s: %s\n", tnm, vptr) ;
    
    const char *(*val)[] ;
    int ret = ConfGetList("score.1.fruit", &val) ;
    printf("ret [%d] \n", ret) ;
    for(int i = 0  ; i < ret ; ++i ) {
        printf("idx [%d] [%s]\n", i, (*val)[i]) ;
    }
    free(val) ;
    return 0 ;
}



